home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-03
/
qbfaqr01.zip
/
DIR.BAS
< prev
next >
Wrap
BASIC Source File
|
1992-04-10
|
3KB
|
77 lines
'*********************************************************
'***DIRSUBS module demo ShareWare by HuffWare (C) 1991***
'***You may freely distribute these routines in your ***
'***own programs. The programs DIR.BAS, DIRSUBS.BAS ***
'***and DIR.BI maybe posted in unmodified form on any ***
'***Bulletin Board System. Use of these routines is at***
'***users descretion and HuffWare assumes no liabilty ***
'*********************************************************
'***For more Qbasic or Basic PDS (7.0,7.1+) routines ***
'***and general help contact the Huff & Puff BBS at ***
'***(602)-996-0033 24 hours 7 days/week. ***
'*********************************************************
'***If run in QBX (QB) use QBX /L (QB /L) for InterruptX support***
'$INCLUDE: 'DIR.BI' '***DirSubs header file***
DEFINT A-Z
DIM TDInfo(1 TO MaxFiles) AS TDTA
FormatDir$ = "\ \ \ \ ########## \ \ \ \ \ \\\"
CLS
DirPath$ = "C:\" '***Change to directory to list***
NumberOfFiles = ReadDir(DirPath$, "*.*") '***Load directory into TDInfo array***
SortDir (NumberOfFiles) '***Sort directory***
'***Display directory on screen***
CLS
CurrentDrive = ASC(LEFT$(UCASE$(DirPath$) + CHR$(0), 1)) - 64
IF CurrentDrive < 1 OR CurrentDrive > GetNumberOfDrives% THEN
CurrentDrive = GetCurrentDrive%
END IF
PRINT USING "Volume in Drive \\is \ \"; CHR$(CurrentDrive + 64); GetVolumeName$(DirPath$)
PRINT "Directory of "; DirPath$
PRINT
FOR I = 1 TO NumberOfFiles
IF TDInfo(I).D = True THEN '***Directory entry***
PRINT USING "\ \ <DIR>"; TDInfo(I).FName
ELSE
Rash$ = "...." '***Set attributes***
IF TDInfo(I).R = True THEN
MID$(Rash$, 1, 1) = "R"
END IF
IF TDInfo(I).A = True THEN
MID$(Rash$, 2, 1) = "A"
END IF
IF TDInfo(I).S = True THEN
MID$(Rash$, 3, 1) = "S"
END IF
IF TDInfo(I).H = True THEN
MID$(Rash$, 4, 1) = "H"
END IF
Period = INSTR(TDInfo(I).FName, ".")
IF Period <> 0 THEN
FileName$ = LEFT$(TDInfo(I).FName, Period - 1)
FileExt$ = MID$(TDInfo(I).FName, Period + 1, LEN(TDInfo(I).FName))
ELSE
FileName$ = TDInfo(I).FName
FileExt$ = ""
END IF
'***Convert from 24 hour format to 12 hour format***
Hour = VAL(MID$(TDInfo(I).Time, 1, 2))
IF Hour > 12 THEN
Hour = Hour - 12
AP$ = "pm"
ELSE
AP$ = "am"
END IF
MID$(TDInfo(I).Time, 1, 2) = RIGHT$("0" + LTRIM$(STR$(Hour)), 2)
PRINT USING FormatDir$; FileName$; FileExt$; TDInfo(I).Size; Rash$; TDInfo(I).Date; TDInfo(I).Time; AP$
END IF
NEXT I
PRINT USING " #### File(s) ###,###,### bytes free"; NumberOfFiles; FreeSpace(CurrentDrive)